<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改泵站')" />
	<th:block th:include="include :: select2-css" />
</head>
<body>
    <div class="form-content">
        <form class="form-horizontal" id="form-pumpStation-edit" th:object="${pumpStationInfo}">
            <h4 class="form-header h4">基本信息</h4>
            <input name="id" id="id" autocomplete="off"  class="form-control" type="hidden"   th:field="*{id}">
            <div class="row">
            	<div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>泵站名称：</label>
                        <div class="col-sm-8">
                            <input name="pumpName" id="pumpName" autocomplete="off" placeholder="请输入泵站名称" class="form-control" type="text"  th:field="*{pumpName}">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                 <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>泵站地址：</label>
                        <div class="col-sm-8">
                            <input name="address" autocomplete="off" placeholder="请输入泵站地址" class="form-control" type="text"  th:field="*{address}">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>经度：</label>
                        <div class="col-sm-8">
                            <input name="lng" autocomplete="off" placeholder="请输入经度" class="form-control" type="number" th:field="*{lng}">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>纬度：</label>
                        <div class="col-sm-8">
                            <input name="lat" autocomplete="off" class="form-control" type="number"  placeholder="请输入纬度" th:field="*{lat}">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>近期供水：</label>
                        <div class="col-sm-8">
                            <input name="recentSupplyCapacity" placeholder="请输入近期供水" class="form-control" type="number" required th:field="*{recentSupplyCapacity}"/>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                       <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>远期供水：</label>
                        <div class="col-sm-8">
                            <input name="forwardSupplyCapacity" placeholder="请输入远期供水" autocomplete="off" class="form-control required" type="number" th:field="*{forwardSupplyCapacity}">
                        </div>
                    </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">是否有效：</label>
                        <div class="col-sm-8">
                         <div class="input-group " style="width: 100%">
                                <select name="isValid" class="form-control m-b" th:with="type=${@dict.getType('biz_is_valid')}">
				                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isValid}"></option>
				                </select>
                          </div>
                          </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>热力值：</label>
                        <div class="col-sm-8">
                            <input name="hotVal" autocomplete="off" placeholder="请输入热力值" class="form-control" type="text"  th:field="*{hotVal}">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
            	<div class="col-sm-12">
                   <div class="col-sm-12">
                    <div class="form-group">
                       <label class="col-xs-2 control-label"><span style="color: red; ">*</span>供水区域地图边界：</label>
                        <div class="col-xs-10">
                            <textarea name="waterArea" id ="waterArea" autocomplete="off" placeholder="格式：lng,lat;lng,lat" class="form-control" th:field="*{waterArea}" rows="3"></textarea>
                            <button type="button" class="btn btn-sm btn-primary" onclick="saveWaterArea()"><i class="fa fa-check"></i>编 辑</button>
                        </div>
                    </div>
                </div>
                </div>
            </div>
            <h4 class="form-header h4">其他信息</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label">备注：</label>
                        <div class="col-xs-10">
                            <textarea name="remark" autocomplete="off"   class="form-control" rows="3">[[*{remark}]]</textarea>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: select2-js" />
	<script type="text/javascript">
        var prefix = ctx + "biz/pumpStation";
        var id = $('#id').val();
        // var pumName = $('#pumpName').val();
        var waterAreaValue =  $('#waterArea').text();

        function saveWaterArea(){
            // console.log("选择供水区域范围", "../../../html/areaTool/areaEditTool.html?waterArea=" + waterAreaValue);
            // $._treeTable.bootstrapTreeTable('refresh');
            // $.modal.openTab("选择供水区域范围", encodeURI("../../../html/areaTool/areaEditTool.html?waterArea=" + waterAreaValue + ",id = " + id));
            window.localStorage.setItem('waterAreaValue', waterAreaValue + '=' + id);
            $.modal.openTab("选择供水区域范围", encodeURI("../../../html/areaTool/areaEditTool.html"));
        }
        
        /* $("#form-pumpStation-edit").validate({
        	onkeyup: false,
        	rules:{
        		email:{
                    email:true,
                    remote: {
                        url: prefix + "/checkEmailUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                        	"userId": function() {
                                return $("#userId").val();
                            },
                			"email": function() {
                                return $.common.trim($("#email").val());
                            }
                        },
                        dataFilter: function (data, type) {
                        	return $.validate.unique(data);
                        }
                    }
        		},
        		phonenumber:{
        			isPhone:true,
                    remote: {
                        url: prefix + "/checkPhoneUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                        	"userId": function() {
                        		return $("#userId").val();
                            },
                			"phonenumber": function() {
                                return $.common.trim($("#phonenumber").val());
                            }
                        },
                        dataFilter: function (data, type) {
                        	return $.validate.unique(data);
                        }
                    }
        		},
        	},
        	messages: {
        		"email": {
                    remote: "Email已经存在"
                },
        		"phonenumber":{
                	remote: "手机号码已经存在"
        		}
            },
            focusCleanup: true
        }); */
        
        function submitHandler() {
	        if ($.validate.form()) {
	        	var data = $("#form-pumpStation-edit").serializeArray();
	        	$.operate.saveTab(prefix + "/edit", data);
	        }
	    }
        /*function refresh(){
            window.location.reload();
        }
        setTimeout('refresh()', 5000);*/
    </script>
</body>
</html>